﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Animation;

namespace MapLibrary.Particles.Emitters
{
    public class ExplosionEmitter : TriggeredEmitterFromData
    {
        private const float VELOCITY_MULTIPLIER = 4.0f;

        public ExplosionEmitter(ParticleManager manager, Sprite s)
            : base(manager, s, "ExplosionParticleEffect")
        {

        }

        protected override void Emit()
        {
            List<ParticleInitialConditions> newCondData = new List<ParticleInitialConditions>();
            ParticleInitialConditions newCond = new ParticleInitialConditions();
            //translate all of the particles to be at the body.
            foreach (ParticleInitialConditions cond in initialCondData)
            {
                newCond = cond.Copy();
                newCond.Position = newCond.Position + sprite.Body.Position;
                newCond.Velocity = newCond.Velocity * VELOCITY_MULTIPLIER;
                newCondData.Add(newCond);
            }

            particleManager.GetFromInitialConditions(newCondData);
        }
    }
}
